package company.huawei.od;

import java.util.*;

/**
 * Created with IntelliJ IDEA.
 * Author: Amos
 * E-mail: amos@amoscloud.com
 * Date: 2021/7/8
 * Time: 13:44
 * Description: 90
 */
public class Main74 {
    public static void main(String[] args) {
        /*
        给定一个字符串S

        变化规则:
         交换字符串中任意两个不同位置的字符

        输入描述：
         一串小写字母组成的字符串
        输出描述：
         按照要求变换得到最小字符串

        实例1：
         输入：、
         abcdef
        输出
         abcdef

        实例2：
         输入
         bcdefa

         acedfk

         acdefk
         输出
         acdefk

        s都是小写字符组成
        1<=s.length<=1000
         */

        Scanner in = new Scanner(System.in);
        String str = in.nextLine();
        in.close();
        String[] split = str.split("");
        int len = split.length;
        char[] origin = str.toCharArray();
        List<String> sorted = Arrays.asList(split);
        Collections.sort(sorted);
        int index = 0;
        while (index < len) {
            String target = sorted.get(index);
            if (target.equals(origin[index] + "")) {
                ++index;
                continue;
            }
            int i = str.indexOf(target);
            char temp = origin[i];
            origin[i] = origin[index];
            origin[index] = temp;
            System.out.println(new String(origin));
            return;
        }
        System.out.println(str);

    }
}
